# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-censys
pkgname=('python2-censys' 'python-censys')
_pkgname=censys
pkgver=2.2.18
pkgrel=1
epoch=1
pkgdesc='Python library for interacting with Censys Search Engine (censys.io).'
arch=('any')
url='https://pypi.org/project/censys/#files'
license=('Apache')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('360b29eb46e941dc6fdd50441476ac0cb7a5bcc4bae4360ac40806e65f0dba82263ba2bf4facdf0540ab27b90268508c5713d43d13a9eda28dc1c8884480e54b')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-censys() {
  depends=('python2' 'python2-requests' 'python2-netaddr' 'python2-backoff')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-censys() {
  depends=('python' 'python-requests' 'python-netaddr' 'python-backoff'
           'python-rich')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

